import java.util.LinkedList;
import java.util.Scanner;


public class Rotate {

	public static void rotate_right(String p) {
		LinkedList<LinkedList<String>> data = new LinkedList<LinkedList<String>>();
		
		Scanner s = new Scanner(p);
		s.useDelimiter("\n");
		int lineCount=0;
		while(s.hasNext()) {
			String line = s.next();
			for(int i=0; i<line.length(); i++) {
//				System.out.println(line.charAt(i));
				while(data.size() <= i) {
					data.add(new LinkedList<String>());
				}
				while(data.get(i).size() <= lineCount+1) {
					data.get(i).add("");
					System.out.println(i+","+lineCount);
				}
				data.get(i).add(lineCount,""+line.charAt(i));
			}
			lineCount++;
//			System.out.println("-----------");
		}
		for(int i=0; i<data.size(); i++) {
			for(int j=0; j<data.get(i).size(); j++) {
				System.out.print(data.get(i).get(j));
			}
			System.out.println();
		}
	}
	
	public static void main(String args[]) {
		String tmp = "lab lab 2\nblah blah 1\n";
		rotate_right(tmp);
	}
}
